﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLT_BLL;
using QLT_Public;
using QLThuoc_report;

namespace GiaoDien
{
    public partial class uc_ThongKe_DoanhThu_TheoThang : DevExpress.XtraEditors.XtraUserControl
    {
        public uc_ThongKe_DoanhThu_TheoThang()
        {
            InitializeComponent();
        }
        ThongKe_BLL thongKe_bll = new ThongKe_BLL();
        private void uc_ThongKe_DoanhThu_TheoThang_Load(object sender, EventArgs e)
        {
            gridControl1.DataSource = thongKe_bll.Load_ThongKe_DoanhThu_TheoThang();
        }

        private void btn_TimKiem_Click(object sender, EventArgs e)
        {
            string m = txt_Thang.Text, y = txtNam.Text;
            gridControl1.DataSource = thongKe_bll.ThongKe_DoanhThu_TheoThang(m,y);
        }

        private void txtNam_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
                e.Handled = true;
        }

        private void bbi_IN_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (txt_Thang.Text != "" && txtNam.Text != "")
            {
                Frm_TkeDoanhThuTheoThang f = new Frm_TkeDoanhThuTheoThang();
                f.Thang = int.Parse(txt_Thang.Text);
                f.Nam = int.Parse(txtNam.Text);
                f.ShowDialog();
            }
            else
                XtraMessageBox.Show("Bạn chưa nhập tháng hoặc năm để thống kê!","Thông Báo",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }
    }
}
